# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

# https://pulsar.apache.org/docs/en/next/reference-metrics/
METRIC_MAP = {
    'bookie_SERVER_STATUS': 'bookie_SERVER_STATUS',
    'bookkeeper_server_ADD_ENTRY_count': 'bookkeeper_server_ADD_ENTRY_count',
    'bookkeeper_server_READ_ENTRY_count': 'bookkeeper_server_READ_ENTRY_count',
    'bookie_WRITE_BYTES': 'bookie_WRITE_BYTES',
    'bookie_READ_BYTES': 'bookie_READ_BYTES',
    'bookie_journal_JOURNAL_SYNC_count': 'bookie_journal_JOURNAL_SYNC_count',
    'bookie_journal_JOURNAL_QUEUE_SIZE': 'bookie_journal_JOURNAL_QUEUE_SIZE',
    'bookie_journal_JOURNAL_FORCE_WRITE_QUEUE_SIZE': 'bookie_journal_JOURNAL_FORCE_WRITE_QUEUE_SIZE',
    'bookie_journal_JOURNAL_CB_QUEUE_SIZE': 'bookie_journal_JOURNAL_CB_QUEUE_SIZE',
    'bookie_ledgers_count': 'bookie_ledgers_count',
    'bookie_entries_count': 'bookie_entries_count',
    'bookie_write_cache_size': 'bookie_write_cache_size',
    'bookie_read_cache_size': 'bookie_read_cache_size',
    'bookie_DELETED_LEDGER_COUNT': 'bookie_DELETED_LEDGER_COUNT',
    'bookie_ledger_writable_dirs': 'bookie_ledger_writable_dirs',
    'bookie_flush': 'bookie_flush',
    'bookie_throttled_write_requests': 'bookie_throttled_write_requests',
    'bookkeeper_server_BOOKIE_QUARANTINE_count': 'bookkeeper_server_BOOKIE_QUARANTINE_count',
    'pulsar_topics_count': 'topics_count',
    'pulsar_subscriptions_count': 'subscriptions_count',
    'pulsar_producers_count': 'producers_count',
    'pulsar_consumers_count': 'consumers_count',
    'pulsar_rate_in': 'rate_in',
    'pulsar_rate_out': 'rate_out',
    'pulsar_throughput_in': 'throughput_in',
    'pulsar_throughput_out': 'throughput_out',
    'pulsar_storage_size': 'storage_size',
    'pulsar_storage_logical_size': 'storage_logical_size',
    'pulsar_storage_backlog_size': 'storage_backlog_size',
    'pulsar_storage_offloaded_size': 'storage_offloaded_size',
    'pulsar_storage_write_rate': 'storage_write_rate',
    'pulsar_storage_read_rate': 'storage_read_rate',
    'pulsar_subscription_delayed': 'subscription_delayed',
    'pulsar_replication_rate_in': 'replication_rate_in',
    'pulsar_replication_rate_out': 'replication_rate_out',
    'pulsar_replication_throughput_in': 'replication_throughput_in',
    'pulsar_replication_throughput_out': 'replication_throughput_out',
    'pulsar_replication_backlog': 'replication_backlog',
    'pulsar_replication_rate_expired': 'replication_rate_expired',
    'pulsar_replication_connected_count': 'replication_connected_count',
    'pulsar_replication_delay_in_seconds': 'replication_delay_in_seconds',
    'pulsar_storage_backlog_quota_limit': 'storage_backlog_quota_limit',
    'pulsar_in_bytes_total': 'in_bytes_total',
    'pulsar_in_messages_total': 'in_messages_total',
    'pulsar_out_bytes_total': 'out_bytes_total',
    'pulsar_out_messages_total': 'out_messages_total',
    'pulsar_compaction_removed_event_count': 'compaction_removed_event_count',
    'pulsar_compaction_succeed_count': 'compaction_succeed_count',
    'pulsar_compaction_failed_count': 'compaction_failed_count',
    'pulsar_compaction_duration_time_in_mills': 'compaction_duration_time_in_mills',
    'pulsar_compaction_read_throughput': 'compaction_read_throughput',
    'pulsar_compaction_write_throughput': 'compaction_write_throughput',
    'pulsar_compaction_compacted_entries_count': 'compaction_compacted_entries_count',
    'pulsar_compaction_compacted_entries_size': 'compaction_compacted_entries_size',
    'pulsar_broker_load_manager_bundle_assignment': 'broker_load_manager_bundle_assignment',
    'pulsar_broker_lookup': 'broker_lookup',
    'pulsar_broker_lookup_redirects': 'broker_lookup_redirects',
    'pulsar_broker_lookup_answers': 'broker_lookup_answers',
    'pulsar_broker_lookup_failures': 'broker_lookup_failures',
    'pulsar_broker_lookup_pending_requests': 'broker_lookup_pending_requests',
    'pulsar_broker_topic_load_pending_requests': 'broker_topic_load_pending_requests',
    'pulsar_ml_cache_evictions': 'ml_cache_evictions',
    'pulsar_ml_cache_hits_rate': 'ml_cache_hits_rate',
    'pulsar_ml_cache_hits_throughput': 'ml_cache_hits_throughput',
    'pulsar_ml_cache_misses_rate': 'ml_cache_misses_rate',
    'pulsar_ml_cache_misses_throughput': 'ml_cache_misses_throughput',
    'pulsar_ml_cache_pool_active_allocations': 'ml_cache_pool_active_allocations',
    'pulsar_ml_cache_pool_active_allocations_huge': 'ml_cache_pool_active_allocations_huge',
    'pulsar_ml_cache_pool_active_allocations_normal': 'ml_cache_pool_active_allocations_normal',
    'pulsar_ml_cache_pool_active_allocations_small': 'ml_cache_pool_active_allocations_small',
    'pulsar_ml_cache_pool_allocated': 'ml_cache_pool_allocated',
    'pulsar_ml_cache_pool_used': 'ml_cache_pool_used',
    'pulsar_ml_cache_used_size': 'ml_cache_used_size',
    'pulsar_ml_count': 'ml_count',
    'pulsar_ml_AddEntryBytesRate': 'ml_AddEntryBytesRate',
    'pulsar_ml_AddEntryWithReplicasBytesRate': 'ml_AddEntryWithReplicasBytesRate',
    'pulsar_ml_AddEntryErrors': 'ml_AddEntryErrors',
    'pulsar_ml_AddEntryMessagesRate': 'ml_AddEntryMessagesRate',
    'pulsar_ml_AddEntrySucceed': 'ml_AddEntrySucceed',
    'pulsar_ml_MarkDeleteRate': 'ml_MarkDeleteRate',
    'pulsar_ml_NumberOfMessagesInBacklog': 'ml_NumberOfMessagesInBacklog',
    'pulsar_ml_ReadEntriesBytesRate': 'ml_ReadEntriesBytesRate',
    'pulsar_ml_ReadEntriesErrors': 'ml_ReadEntriesErrors',
    'pulsar_ml_ReadEntriesRate': 'ml_ReadEntriesRate',
    'pulsar_ml_ReadEntriesSucceeded': 'ml_ReadEntriesSucceeded',
    'pulsar_ml_StoredMessagesSize': 'ml_StoredMessagesSize',
    'brk_ml_cursor_persistLedgerSucceed': 'brk_ml_cursor_persistLedgerSucceed',
    'brk_ml_cursor_persistLedgerErrors': 'brk_ml_cursor_persistLedgerErrors',
    'brk_ml_cursor_persistZookeeperSucceed': 'brk_ml_cursor_persistZookeeperSucceed',
    'brk_ml_cursor_persistZookeeperErrors': 'brk_ml_cursor_persistZookeeperErrors',
    'brk_ml_cursor_nonContiguousDeletedMessagesRange': 'brk_ml_cursor_nonContiguousDeletedMessagesRange',
    'brk_ml_cursor_writeLedgerSize': 'brk_ml_cursor_writeLedgerSize',
    'brk_ml_cursor_writeLedgerLogicalSize': 'brk_ml_cursor_writeLedgerLogicalSize',
    'brk_ml_cursor_readLedgerSize': 'brk_ml_cursor_readLedgerSize',
    'pulsar_lb_bandwidth_in_usage': 'lb_bandwidth_in_usage',
    'pulsar_lb_bandwidth_out_usage': 'lb_bandwidth_out_usage',
    'pulsar_lb_cpu_usage': 'lb_cpu_usage',
    'pulsar_lb_directMemory_usage': 'lb_directMemory_usage',
    'pulsar_lb_memory_usage': 'lb_memory_usage',
    'pulsar_lb_unload_broker_count': 'lb_unload_broker_count',
    'pulsar_lb_unload_bundle_count': 'lb_unload_bundle_count',
    'pulsar_lb_bundles_split_count': 'lb_bundles_split_count',
    'pulsar_bundle_msg_rate_in': 'bundle_msg_rate_in',
    'pulsar_bundle_msg_rate_out': 'bundle_msg_rate_out',
    'pulsar_bundle_topics_count': 'bundle_topics_count',
    'pulsar_bundle_consumer_count': 'bundle_consumer_count',
    'pulsar_bundle_producer_count': 'bundle_producer_count',
    'pulsar_bundle_msg_throughput_in': 'bundle_msg_throughput_in',
    'pulsar_bundle_msg_throughput_out': 'bundle_msg_throughput_out',
    'pulsar_subscription_back_log': 'subscription_back_log',
    'pulsar_subscription_msg_rate_redeliver': 'subscription_msg_rate_redeliver',
    'pulsar_subscription_unacked_messages': 'subscription_unacked_messages',
    'pulsar_subscription_blocked_on_unacked_messages': 'subscription_blocked_on_unacked_messages',
    'pulsar_subscription_msg_rate_out': 'subscription_msg_rate_out',
    'pulsar_subscription_msg_throughput_out': 'subscription_msg_throughput_out',
    'pulsar_consumer_msg_rate_redeliver': 'consumer_msg_rate_redeliver',
    'pulsar_consumer_unacked_messages': 'consumer_unacked_messages',
    'pulsar_consumer_blocked_on_unacked_messages': 'consumer_blocked_on_unacked_messages',
    'pulsar_consumer_msg_rate_out': 'consumer_msg_rate_out',
    'pulsar_consumer_msg_throughput_out': 'consumer_msg_throughput_out',
    'pulsar_consumer_available_permits': 'consumer_available_permits',
    'pulsar_expired_token_count': 'expired_token_count',
    'pulsar_authentication_success_count': 'authentication_success_count',
    'pulsar_authentication_failures_count': 'authentication_failures_count',
    'pulsar_active_connections': 'active_connections',
    'pulsar_connection_created_total_count': 'connection_created_total_count',
    'pulsar_connection_create_success_count': 'connection_create_success_count',
    'pulsar_connection_create_fail_count': 'connection_create_fail_count',
    'pulsar_connection_closed_total_count': 'connection_closed_total_count',
    'pulsar_broker_throttled_connections': 'broker_throttled_connections',
    'pulsar_broker_throttled_connections_global_limit': 'broker_throttled_connections_global_limit',
    'jetty_requests_total': 'jetty_requests_total',
    'jetty_requests_active': 'jetty_requests_active',
    'jetty_requests_active_max': 'jetty_requests_active_max',
    'jetty_request_time_max_seconds': 'jetty_request_time_max_seconds',
    'jetty_request_time_seconds_total': 'jetty_request_time_seconds_total',
    'jetty_dispatched_total': 'jetty_dispatched_total',
    'jetty_dispatched_active': 'jetty_dispatched_active',
    'jetty_dispatched_active_max': 'jetty_dispatched_active_max',
    'jetty_dispatched_time_max': 'jetty_dispatched_time_max',
    'jetty_dispatched_time_seconds_total': 'jetty_dispatched_time_seconds_total',
    'jetty_async_requests_total': 'jetty_async_requests_total',
    'jetty_async_requests_waiting': 'jetty_async_requests_waiting',
    'jetty_async_requests_waiting_max': 'jetty_async_requests_waiting_max',
    'jetty_async_dispatches_total': 'jetty_async_dispatches_total',
    'jetty_expires_total': 'jetty_expires_total',
    'jetty_responses_total': 'jetty_responses_total',
    'jetty_stats_seconds': 'jetty_stats_seconds',
    'jetty_responses_bytes_total': 'jetty_responses_bytes_total',
    'pulsar_function_processed_successfully_total': 'function_processed_successfully_total',
    'pulsar_function_processed_successfully_total_1min': 'function_processed_successfully_total_1min',
    'pulsar_function_system_exceptions_total': 'function_system_exceptions_total',
    'pulsar_function_system_exceptions_total_1min': 'function_system_exceptions_total_1min',
    'pulsar_function_user_exceptions_total': 'function_user_exceptions_total',
    'pulsar_function_user_exceptions_total_1min': 'function_user_exceptions_total_1min',
    'pulsar_function_last_invocation': 'function_last_invocation',
    'pulsar_function_received_total': 'function_received_total',
    'pulsar_function_received_total_1min': 'function_received_total_1min',
    'pulsar_source_written_total': 'source_written_total',
    'pulsar_source_written_total_1min': 'source_written_total_1min',
    'pulsar_source_received_total': 'source_received_total',
    'pulsar_source_received_total_1min': 'source_received_total_1min',
    'pulsar_source_last_invocation': 'source_last_invocation',
    'pulsar_source_source_exception': 'source_source_exception',
    'pulsar_source_source_exceptions_total': 'source_source_exceptions_total',
    'pulsar_source_source_exceptions_total_1min': 'source_source_exceptions_total_1min',
    'pulsar_source_system_exception': 'source_system_exception',
    'pulsar_source_system_exceptions_total': 'source_system_exceptions_total',
    'pulsar_source_system_exceptions_total_1min': 'source_system_exceptions_total_1min',
    'pulsar_sink_written_total': 'sink_written_total',
    'pulsar_sink_written_total_1min': 'sink_written_total_1min',
    'pulsar_sink_received_total_1min': 'sink_received_total_1min',
    'pulsar_sink_received_total': 'sink_received_total',
    'pulsar_sink_last_invocation': 'sink_last_invocation',
    'pulsar_sink_sink_exception': 'sink_sink_exception',
    'pulsar_sink_sink_exceptions_total': 'sink_sink_exceptions_total',
    'pulsar_sink_sink_exceptions_total_1min': 'sink_sink_exceptions_total_1min',
    'pulsar_sink_system_exception': 'sink_system_exception',
    'pulsar_sink_system_exceptions_total': 'sink_system_exceptions_total',
    'pulsar_sink_system_exceptions_total_1min': 'sink_system_exceptions_total_1min',
    'pulsar_proxy_active_connections': 'proxy_active_connections',
    'pulsar_proxy_new_connections': 'proxy_new_connections',
    'pulsar_proxy_rejected_connections': 'proxy_rejected_connections',
    'pulsar_proxy_binary_ops': 'proxy_binary_ops',
    'pulsar_proxy_binary_bytes': 'proxy_binary_bytes',
    'split_bytes_read': 'split_bytes_read',
    'split_num_messages_deserialized': 'split_num_messages_deserialized',
    'split_num_record_deserialized': 'split_num_record_deserialized',
    'pulsar_txn_active_count': 'txn_active_count',
    'pulsar_txn_created_count': 'txn_created_count',
    'pulsar_txn_committed_count': 'txn_committed_count',
    'pulsar_txn_aborted_count': 'txn_aborted_count',
    'pulsar_txn_timeout_count': 'txn_timeout_count',
    'pulsar_txn_append_log_count': 'txn_append_log_count',
}
